package aooO.crm.Service.impl;

import aooO.crm.Service.ActivityRemarkService;
import aooO.crm.Service.ActivityService;
import aooO.crm.mapper.ActivityMapper;
import aooO.crm.pojo.Activity;
import aooO.crm.pojo.FunnelVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class ActivityServiceImpl implements ActivityService {

    @Autowired
    ActivityMapper activityMapper;

    @Autowired
    ActivityRemarkService activityRemarkService;

    @Override
    public List<Activity> queryActivityByConditionForPage(HashMap<String, Object> map) {
        return activityMapper.queryActivityByConditionForPage(map);
    }

    @Override
    public int selectAllCount(HashMap<String, Object> map) {
        return activityMapper.selectAllCount(map);
    }

    @Override
    public int insert(Activity activity) {
        return activityMapper.insert(activity);
    }

    @Override
    public int deleteActivityByIds(String[] ids) {
        //先删除线索下的评论  在serviceImpl里面配置了事务回滚  两个操作需要同时成功
        activityRemarkService.deleteRemarkByActivityId(ids);
        int i = activityMapper.deleteActivityByIds(ids);
        return i;
    }

    @Override
    public Activity queryActivityById(String id) {
        return activityMapper.queryActivityById(id);
    }

    @Override
    public Activity selectActivityDetailById(String id) {
        return activityMapper.selectActivityDetailById(id);
    }

    @Override
    public int saveEditActivity(Activity activity) {
        return activityMapper.saveEditActivity(activity);
    }

    @Override
    public List<Activity> selectAllActivities() {
        return activityMapper.selectAllActivities();
    }

    @Override
    public List<Activity> selectActivitiesByIds(String[] id) {
        return activityMapper.selectActivitiesByIds(id);
    }

    @Override
    public int insertByList(List<Activity> activity) {
        return activityMapper.insertByList(activity);
    }

    @Override
    public List<Activity> selectAllActivityByClueId(String clue_id) {
        return activityMapper.selectAllActivityByClueId(clue_id);
    }

    @Override
    public List<Activity> queryActivityForDetailByNameAndClueId(Map<String, Object> map) {
        return activityMapper.queryActivityForDetailByNameAndClueId(map);
    }

    @Override
    public List<Activity> queryActivityForConvertByNameAndClueId(Map<String, Object> map) {
        return activityMapper.queryActivityForConvertByNameAndClueId(map);
    }

    @Override
    public List<Activity> queryActivityForDetailByNameAndContactsId(Map<String, Object> map) {
        return activityMapper.queryActivityForDetailByNameAndContactsId(map);
    }

    @Override
    public List<Activity> selectActivityForDetailByContactsId(String contacts_id) {
        return activityMapper.selectActivityForDetailByContactsId(contacts_id);
    }

    @Override
    public List<Activity> selectActivityByFuzzyName(String activityName) {
        return activityMapper.selectActivityByFuzzyName(activityName);
    }

    @Override
    public List<FunnelVO> selectCountOfActivityGroupByOwner() {
        return activityMapper.selectCountOfActivityGroupByOwner();
    }

}
